﻿using System;

namespace SilverlightTetris_M10CDE.Web
{
    /// <summary>
    /// Stores and updates X and Y coordinates for a block
    /// </summary>
    public class Block
    {
        public int xPosition { get; set; }
        public int yPosition { get; set; }

        /// <summary>
        /// Create Block constructor
        /// </summary>
        /// <param name="startX"></param>
        /// <param name="startY"></param>
        public Block(int xPosition, int yPosition)
        {
            this.xPosition = xPosition;
            this.yPosition = yPosition;
        }

        /// <summary>
        /// Updates a blocks X or Y coordinate depending on direction
        /// </summary>
        /// <param name="direction"></param>
        public void moveBlock(Char direction)
        {
            if (direction == 'N')
            {
                yPosition--;
            }
            else if (direction == 'E')
            {
                xPosition++;
            }
            else if (direction == 'S')
            {
                yPosition++;
            }
            else if (direction == 'W')
            {
                xPosition--;
            }
        }
    }
}